const { loginCheck } = require('../controller/user')
const { SuccessModel, ErrorModel } = require('../model/resModel')
const handleUserRouter = (req, res) => {
    const method = req.method
    console.log(req.body , 'req.body')
    //博客登录接口
    if (method === 'POST' && req.path === '/api/user/login') {
        const {username, password} = req.body
        const result = loginCheck(username, password)
        if (result) {
            return new SuccessModel('ok')
        } 
        return new ErrorModel('登录失败~')
    }
}

module.exports = handleUserRouter